import org.eclipse.jface.dialogs.MessageDialog
import org.eclipse.swt.SWT
import org.eclipse.swt.layout.GridLayout
import org.eclipse.swt.widgets.*


// a demo class for implementing the View 
class MyView extends org.eclipse.ui.part.ViewPart {
	
	public void createPartControl(Composite composite) {
		
		GridLayout l = new GridLayout()
        l.numColumns = 4
        
		composite.setLayout(l)
		
		Text text = new Text(composite, SWT.SINGLE)
		
		Button button = new Button(composite, SWT.PUSH)
		button.setText("Say it!")
		
		Label label = new Label(composite, SWT.HORIZONTAL)
		label.setText("This is the Demo view!")
	
		button.addListener( SWT.Selection, new MyListener(l: label, t: text))
		
	}

	public void setFocus() {
    	
	}
	
    def dispose(){
    	
    }
    
    // the "part" class must implement a meaningful equals() method
    // as the PartTester class will verify this 
    public boolean equals(java.lang.Object o){
    	if(o == null){
    		return false;
    	}
    	
    	if( !(o instanceof org.eclipse.ui.IViewPart)){
    		return false
    	}
    	
    	return true;
    }
    
}

class MyListener implements Listener {
	Label l;
	Text t;
	
    public void handleEvent(Event event) {
        l.setText(t.getText())
    }
}

def view = new MyView();
view
